    /*author：snuser  return array ,  need tool about 'dateFormat.js' */  
      
    /* 
     
    ex: 
     
    date = new Date(); 
     
    console.log( date.dateChange( "lastmonth" ) ); 
     
    */  
      
    function dateChange( part ) {  
      
    var beginTime;  
      
    var now   = new Date();  
      
    var month = now.getMonth();  
      
    var year  = now.getFullYear();  
      
    var day   = now.getDate();  
      
    var wday  = now.getDay;  
      
    function unsetTime( thisdate ) {  
      
    thisdate.setUTCHours( 0 );  
      
    thisdate.setUTCMinutes( 0 );  
      
    thisdate.setUTCSeconds( 0 );  
      
    }  
      
    switch ( part ) {  
    
    //当天
    case "thisday" :  
        
    unsetTime(now);  
          
    now.beginTime = now.format( "yyyy-MM-dd", now.setDate( day ) );  
          
    now.endTime   = now.format( "yyyy-MM-dd", now.setDate( day ) );  
          
    break;  
    
      
    //当月  
      
    case "thismonth" :  
      
    unsetTime(now);  
      
    now.beginTime = now.format( "yyyy-MM-dd", now.setDate( 1 ) );  
      
    now.endTime   = now.format( "yyyy-MM-dd", now.setMonth( month +1 ) );  
      
    break;  
      
    //上个月  
      
    case "lastmonth" :  
      
    unsetTime(now);  
      
    now.setMonth( month - 1 );  
      
    now.beginTime = now.format( "yyyy-MM-dd", now.setDate( 1 ) );  
      
    now.endTime   = now.format( "yyyy-MM-dd", now.setMonth( month ) );  
      
    break;  
      
    //最近7天  
      
    case "lastsevendays" : 
    	
    now.endTime   = now.format( "yyyy-MM-dd", now.setDate( day ) ); 
      
    now.beginTime = now.format( "yyyy-MM-dd", now.setDate( day-7 ) );  
      
    break;  
      
    //最近一个月  
      
    case "recentmonth" :  
      
    now.endTime   = now.format( "yyyy-MM-dd",  now.setDate( day ) );  
      
    now.beginTime = now.format( "yyyy-MM-dd", now.setDate( day-30 ) );  
      
    break;  
    
    //最近三个月  
    
    case "threemonth" :  
      
    now.endTime = now.format( "yyyy-MM-dd", now.setDate( day ) );  
         
    now.beginTime   = now.format( "yyyy-MM-dd", now.setDate( day-90 ) );  
      
    break;
    
    //最近一年 
    
    case "recentyear" :  
      
    now.setFullYear( year - 1 );  
    
    now.beginTime   = now.format( "yyyy-MM-dd", now.setDate( day ) ); 
        
    now.endTime = now.format( "yyyy-MM-dd", now.setFullYear( year ) );      
      
    break;    
    
      
    default:   
      
    now.endTime = null; now.beginTime = null;  
      
    break;  
      
    }  
      
    return [now.beginTime, now.endTime];  
      
       
      
    }  
      
    Date.prototype.dateChange = function ( part ) {  
      
    return dateChange( part );  
      
    };  
      
       
      
   